package sword_to_1;

public class LeeCode_10_1 {
    public static void main(String[] args) {
        System.out.println(fib(46));
    }
    private static int fib(int n2) {
        long n = n2;
        if (n == 0)
            return 0;
        long l1 = 0, l2 = 1, i = 1;
        long ans = 1;
        while (i++ < n){
            ans = l1 + l2;
            l1 = l2;
            l2 = ans;
            if (l1 > 1000000007){
                l1 -= 1000000007;
                l2 -= 1000000007;
            }
        }
        return (int) (ans % 1000000007);
    }
}
